package com.lzh.gulimall.cart.config;

import com.lzh.gulimall.cart.interceptor.CartInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName GulimallWebConfig
 * @Description TODO
 * @Author liuzhihui
 * @Date 2020/9/2 0:41
 * @Version 1.0
 **/
@Configuration
public class GulimallWebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //当前购物车的所有请求都要被这个拦截器拦截
        registry.addInterceptor(new CartInterceptor()).addPathPatterns("/**");
    }
}
